import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ImportBillVO, ImportBillForm, ImportBillQuery } from '@/api/warehouse/importBill/types';

/**
 * 查询入库单列表
 * @param query
 * @returns {*}
 */

export const listImportBill = (query?: ImportBillQuery): AxiosPromise<ImportBillVO[]> => {
  return request({
    url: '/warehouse/importBill/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询入库单详细
 * @param id
 */
export const getImportBill = (id: string | number): AxiosPromise<ImportBillVO> => {
  return request({
    url: '/warehouse/importBill/' + id,
    method: 'get'
  });
};

/**
 * 新增入库单
 * @param data
 */
export const addImportBill = (data: ImportBillForm) => {
  return request({
    url: '/warehouse/importBill',
    method: 'post',
    data: data
  });
};

/**
 * 修改入库单
 * @param data
 */
export const updateImportBill = (data: ImportBillForm) => {
  return request({
    url: '/warehouse/importBill',
    method: 'put',
    data: data
  });
};

/**
 * 删除入库单
 * @param id
 */
export const delImportBill = (id: string | number | Array<string | number>) => {
  return request({
    url: '/warehouse/importBill/' + id,
    method: 'delete'
  });
};
